package com.test.cordova;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.transition.Explode;
import android.transition.Fade;
import android.transition.Slide;

/**
 * Created by Administrator on 2019/1/30 0030.
 */

public class TransitionActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        //进入退出效果 注意这里 创建的效果对象是 Explode()
        Intent intent = getIntent();
        if (intent != null) {
            int type = intent.getIntExtra("type", 0);
            switch (type) {
                case 1:
                    getWindow().setEnterTransition(new Explode().setDuration(2000));
                    getWindow().setExitTransition(new Explode().setDuration(2000));
                    break;
                case 2:
                    getWindow().setEnterTransition(new Slide().setDuration(2000));
                    getWindow().setExitTransition(new Slide().setDuration(2000));
                    break;
                case 3:
                    getWindow().setEnterTransition(new Fade().setDuration(2000));
                    getWindow().setExitTransition(new Fade().setDuration(2000));
                    break;
            }

        }

    }

}
